<template>
	<view class="zai-box">
		<!-- <image src="../../static/zaizai-login/login.png" mode='aspectFit' class="zai-logo"></image> -->
		<view class="zai-title">实验室预约管理系统</view>
		<view class="zai-form">
			<input class="zai-input" placeholder-class placeholder="请输入账号" v-model="loginForm.account" />
			<input class="zai-input" placeholder-class password placeholder="请输入密码" v-model="loginForm.password" />
			<view class="zai-label">忘记密码？</view>
			<button class="zai-btn" @click="handleLogin">立即登录</button>
			<navigator url="../zaizai-register/index" hover-class="none" class="zai-label">还没有账号？点此注册.</navigator>
		</view>
	</view>
</template>

<script>
	import {
		Login
	} from '../../api/login.js'
	export default {
		data() {
			return {
				loginForm: {}
			}
		},
		methods: {
			handleLogin() {
				if (!this.loginForm.account || !this.loginForm.password) {
					uni.showToast({
						icon: 'none',
						title: "账号或密码不能为空",
						duration: 3000
					})
				} else {
					Login(this.loginForm).then(res => {
						// console.log(res);
						if (res.status == 200) {
							uni.navigateTo({
								url: "/pages/index/index"
							})
						}
					}).catch(err => {
						// console.log(err);
					})
				}

			}
		}
	}
</script>

<style lang="scss" scoped>
	.zai-box {
		overflow: hidden;
		min-height: 100vh;
		padding: 0 100upx;
		position: relative;
		// background-color: pink;
		background: url('http://43.142.185.98/images/loginbgc.png');
		background-position: center center;
		background-size: cover;
	}

	// .zai-logo {
	// 	width: 100%;
	// 	width: 100%;
	// 	height: 310upx;
	// }

	.zai-title {

		// position: absolute;
		// top: 0;
		// line-height: 360upx;
		font-size: 53upx;
		color: #fff;
		text-align: center;
		width: 100%;
		margin-top: 80upx;
		// margin-left: -100upx;
	}

	.zai-form {
		margin-top: 250upx;
	}

	.zai-input {
		background: #e2f5fc;
		margin-top: 30upx;
		border-radius: 100upx;
		padding: 20upx 40upx;
		font-size: 36upx;
	}

	.input-placeholder,
	.zai-input {
		color: #94afce;
	}

	.zai-label {
		padding: 30upx 0;
		text-align: center;
		font-size: 30upx;
		color: #a7b6d0;
	}

	.zai-btn {
		background: #ff65a3;
		color: #fff;
		border: 0;
		border-radius: 100upx;
		font-size: 36upx;
	}

	.zai-btn:after {
		border: 0;
	}

	/*按钮点击效果*/
	.zai-btn.button-hover {
		transform: translate(1upx, 1upx);
	}
</style>